<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <div id="app">
        {{list}}
        <button @click="add">添加单个</button>
        <button @click='addmore'>添加多个</button>
    </div>
    <script src="./vue.js"></script>
    <script>
        let vm = new Vue({
            el: "#app",
            data: {
                list: {
                    name: "zs",
                    age: '111',
                }
            },
            methods: {
                add() {
                    vm.$set(this.list, 'sex', '男')
                    Vue.set(vm.list, 'hoddy', '唱歌')
                },
                addmore() {
                    // this.list = Object(this.list, {
                    //     sex: "楠楠楠",
                    //     like: "唱歌，跳五"
                    // })//无响应
                    let obj = Object.assign(vm.list, {
                        sex: "楠楠楠",
                        like: "唱歌，跳五"
                    })

                    //console.log(obj)
                    vm.$set(this.list, obj)
                }
            },
        })

        //添加属性
        // 直接添加是无用的,用vm.$set  Vue.set
    </script>
</body>

</html>